package message;

import io.netty.channel.Channel;
import io.netty.channel.pool.ChannelPoolHandler;
import io.netty.channel.socket.SocketChannel;

public class NettyChannelPoolHandler implements ChannelPoolHandler {
	@Override
	public void channelReleased(Channel ch) throws Exception {
		System.out.println("channelReleased. Channel ID: " + ch.id());
	}

	@Override
	public void channelAcquired(Channel ch) throws Exception {
		System.out.println("channelAcquired. Channel ID: " + ch.id());
	}

	@Override
	public void channelCreated(Channel ch) throws Exception {
		// ByteBuf delimiter = Unpooled.copiedBuffer("$_".getBytes());
		System.out.println("channelCreated. Channel ID: " + ch.id());
		SocketChannel channel = (SocketChannel) ch;
		channel.config().setKeepAlive(true);
		channel.config().setTcpNoDelay(true);
		// channel.pipeline().addLast(new DelimiterBasedFrameDecoder(1024,
		// delimiter)).addLast(new StringDecoder())
		// .addLast(new StringEncoder()).addLast(new
		// WebSocketChannelInitializer());

	}
}